#include <iostream>
#include <string>
using namespace std;

int main()
{
	int n;
	cin >> n;
	string player1, player2;
	while(n--)
	{
		cin >> player1 >> player2;
		if(player1 == player2)
			cout << "Tie" << endl;
		else if(player1 == "Rock" && player2 == "Scissors")
			cout << "player1" << endl;
		else if(player1 == "Paper" && player2 == "Rock")
			cout << "player1" << endl;
		else if(player1 == "Scissors" && player2 == "Paper")
			cout << "player1" << endl;
		else
			cout << "player2" << endl;
	}
	return 0;
}
